#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
    setFixedSize(4*200,4*200);
    pJiyi=new jiyifanpai;
    pMap=new QPainter(this);

}

Widget::~Widget()
{
    delete ui;
}

void Widget::mousePressEvent(QMouseEvent *event)
{
    pJiyi->mousePressEvent(event);
    if(pJiyi->gameOver()){
        end *a = new end();
        this->close();

        a->show();
    }
}



void Widget::paintEvent(QPaintEvent *event)
{
Q_UNUSED(event);
    pMap->begin(this);
    pJiyi->drawMap(pMap);
    pMap->end();
    update();
}
